package com.dotstone.chipism.ui.login.presenter.impl;


import android.util.Log;

import com.dotstone.chipism.ui.login.model.impl.LogInModelImpl;
import com.dotstone.chipism.ui.login.presenter.LogInPresenter;
import com.dotstone.chipism.ui.login.view.LogInView;

import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

/**
 * Created by lvr on 2017/5/19.
 */

public class LogInPresenterImpl implements LogInPresenter {
    private LogInView mView;
    private LogInModelImpl mModel;

    public LogInPresenterImpl(LogInView view) {
        this.mView = view;
        mModel = new LogInModelImpl();
    }
    @Override
    public void requestLogIn(String username, String password) {
        Log.i("登录", "开始222登录" + username + "---" + password);
        mModel.loadLogIn(username,password).subscribe(new Observer<String>() {
            @Override
            public void onSubscribe(Disposable d) {
                Log.i("登录", "onSubscribe");
            }

            @Override
            public void onNext(String aBoolean) {
                Log.i("登录", "onNext");
//                mView.returnLogInResult(aBoolean);
            }

            @Override
            public void onError(Throwable e) {
                Log.i("登录", "onError" + e.getLocalizedMessage() + "---" + e.getMessage());
            }

            @Override
            public void onComplete() {
                Log.i("登录", "onComplete");
            }
        });
    }
}
